import request from '@/utils/request'
import axios from 'axios'
import { getToken } from '@/utils/auth'

export function sydata(city, country) {
    return request({
        url: '/api/index/sydata',
        method: 'get',
        params: {
            city,
            country,
        }
    })
}
// 数据使用申请未办列表  
export function dataagreenolist(listquery) {
    return request({
        url: '/api/authorizerelation/dataagreenolist',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}

export function apply(query) {
    return request({
        url: '/api/authorizerelation/applys',
        method: 'post',
        headers: {
            "Content-Type": "multipart/form-data"
        },
        data: query,
        transformRequest: [function (formDatas) {
            return formDatas;
        }],
    })
}

// 数据使用申请已办列表 //导出
export function dataagreedolist(listquery) {
    return request({
        url: '/api/authorizerelation/dataagreedolist',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}

// 村庄关联改变接口
export function changeVillages(data) {
    return request({
        url: '/api/authorizerelation/changevillages',
        method: 'post',
        params: data
    })
}

// 数据使用授权列表 已办箱
export function setagreeDoList(listquery) {
    return request({
        url: '/api/authorizerelation/setagreedolist',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}

// 数据使用授权列表 未办箱
export function setagreeNoList(listquery) {
    return request({
        url: '/api/authorizerelation/setagreenolist',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}


// 通过授权，上传授权文件 
export function changeapply(data) {
    return request({
        url: '/api/authorizerelation/changeapply',
        method: 'post',
        headers: {
            "Content-Type": "multipart/form-data"
        },
        data: data,
        transformRequest: [function (formDatas) {
            return formDatas;
        }],
        
    })
}
export function changeapplys(data) {
    return request({
        url: '/api/authorizerelation/changeapplys',
        method: 'post',
        headers: {
            "Content-Type": "multipart/form-data"
        },
        data: data,
        transformRequest: [function (formDatas) {
            return formDatas;
        }],
        
    })
}

export function setagreedolist(listquery) {
    return request({
        url: '/api/authorizerelation/setagreedolist',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}

//导出
export function progresslistout(listquery) {
    return request({
        url: '/api/village/progresslistout',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}

// 进度登记查询 
export function progresslist(listquery) {
    return request({
        url: '/api/village/progresslist',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}

// 进度登记导入
export function uploadjdb(data) {
    return request({
        url: '/api/villageprogress/uploadprogresszip',
        method: 'post',
        headers: {
            "Content-Type": "multipart/form-data"
        },
        data: data,
        transformRequest: [function (formDatas) {
            return formDatas;
        }],
    })
  }
  // 进度登记待审核导入
export function uploadprogresszipone(data,callback) {
    return request({
        url: '/api/villageprogress/uploadprogresszipone',
        method: 'post',
        headers: {
            "Content-Type": "multipart/form-data"
        },
        data: data,
        transformRequest: [function (formDatas) {
            return formDatas;
        }],
        onUploadProgress(progressEvent){
            if(progressEvent.lengthComputable){
                let val = (progressEvent.loaded/progressEvent.total*100).toFixed(0);
                var progress = parseInt(val);
                callback(progress)
            }
        }
    })
  }
    // 进度登记待审核导入
export function uploadprogressziponereviewed(data,callback) {
    return request({
        url: '/api/villageprogressreviewed/uploadprogressziponereviewed',
        method: 'post',
        headers: {
            "Content-Type": "multipart/form-data"
        },
        data: data,
        transformRequest: [function (formDatas) {
            return formDatas;
        }],
        onUploadProgress(progressEvent){
            if(progressEvent.lengthComputable){
                let val = (progressEvent.loaded/progressEvent.total*100).toFixed(0);
                var progress = parseInt(val);
                callback(progress)
            }
        }
    })
  }

// 进度预警箱
export function progresswarninglist(listquery) {
    return request({
        url: '/api/village/progresswarninglist',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}
export function areaprogresswarninglist(listquery) {
    return request({
        url: '/api/village/areaprogresswarninglist',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}
// 指标成果未上报箱查询 //导出
export function achievementslist(listquery) {
    return request({
        url: '/api/village/achievementslist',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}
// 指标成果报批
export function updata(query) {
    return request({
        url: '/api/villageachievements/updata',
        method: 'post',
        headers: {
            "Content-Type": "multipart/form-data"
        },
        data: query,
        transformRequest: [function (formDatas) {
            return formDatas;
        }],
    })
}
// 指标成果详情 //导出
export function getdata(id) {
    return request({
        url: '/api/VillageAchievements/getdata',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: id
    })
}
// 分类填报查询 
export function villagelist(listquery) {
    return request({
        url: '/api/village/villagelist',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}
//导出村庄规划信息

export function villageauthorizelist() {
    return request({
        url: '/api/statistical/villageauthorizelist',
        method: 'post',
        responseType: 'blob',
      
    })
}


export function editvillagedata(data) {
    return request({
        url: '/api/village/editvillagedata',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data:data,
    })
}
//获取村庄类型
export function getvillagetypelist() {
    return request({
        url: '/api/village/getvillagetypelist',
        method: 'get',
       
    })
}

//规划编制单位信息
export function profilelist(listquery) {
    return request({
        url: '/api/userprofile/getnamelist',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}

//规划编制单位信息
export function profilelistSimple(listquery) {
    return request({
        url: '/api/userprofile/getnamelistsimple',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}

//底图底数领取情况
export function datareceivelist(listquery) {
    return request({
        url: '/api/statistical/datareceivelist',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}

//辖区规划编制进度
export function progresslistcount(listquery) {
    return request({
        url: '/api/statistical/progresslist',
        method: 'post',
        headers: {
            "Content-Type": "application/json"
        },
        data: listquery
    })
}

//下载保密软件
export function downloadapplyfile() {
    return request({
        url: '/api/authorizerelation/downloadapplyfile',
        method: 'post',
       
    })
}








